<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标事件</title>
    <style>
        div {
            width: 500px;
            height: 500px;
            border: solid;
            
        }
    </style>
</head>
<body>

    <div  onmousedown="handlerDown(this)" onmouseup="handlerUp(this)" onmouseenter="handlerEnter(this)" onmouseleave="handlerLeave(this)">

    </div>

    <script>

        document.onmousemove = function() {
            console.log("xxxx");
        }

        function handlerEnter(obj) {
            obj.style.backgroundColor = 'red'
        }

        function handlerLeave(obj) {
            obj.style.backgroundColor = 'yellow'
        }

        function handlerDown(obj) {
            obj.style.backgroundColor = 'green'
        }

        function handlerUp(obj) {
            obj.style.backgroundColor = 'pink'
        }

    </script>

    
</body>
</html>